Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work in progress #6

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

work in progress #6

wants to merge 8 commits into from

Conversation

nj19721
Copy link
Collaborator

@nj19721 nj19721 commented Apr 12, 2023

No description provided.

@fjebaker
Copy link
Member

Change

include("../solution.jl")

to

using ..DiscSimulations: DiscSolution, OneDimension


##need to add functype constructors??
using TruncatedStacktraces
TruncatedStacktraces.VERBOSE[] = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/solution.jl Outdated Show resolved Hide resolved
src/solution.jl Outdated Show resolved Hide resolved
@fjebaker
Copy link
Member

main(p::Parameters, ::BurgersSimulation) = BurgerTrixi.solve_disc(p.N, p.xmax)

Need to forward parameters here.

Copy link
Member

@fjebaker fjebaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good! The new plot looks very good too 👍

simple_sol =
@time solve(simple_problem, Rodas5(autodiff = false); reltol = 1e-7, abstol = 1e-7)

spectral_x, _, T, Ti, spectral_problem = BurgerSpectral.setup(N, xmax)
spectral_x, _, T, Ti, spectral_problem = BurgerSpectral.setup(N, xmax, initial_condition_burgers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to create a wrapper function that makes the initial condition function formats compatible. BurgerSimple and BurgerSpectral both expect functions in the form of:

f(::AbstractArray)::AbstractArray

whereas your function is of the form

f(::AbstractArray)::Number

To fix, define something like

function _wrap_init_conditions(f::Function)
    function _wrapper(x)
        map(x) do i
            f(SVector(i))
        end
    end
end

You can then use this as

... = BurgerSpectral.setup(N, xmax, _wrap_init_conditions(initial_condition_burgers))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to commit *.pyc files :~)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn I thought I'd added that to the git ignore I don't know why it didn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants